//
//  SwiftChannelPlugin.swift
//  Runner
//
//  Created by topnet on 2021/12/20.
//

import UIKit
import Flutter
//import GMObjC
class SwiftChannelPlugin: NSObject {
    static let channelName = "com.topnet.xxx"
    public var channel: FlutterMethodChannel
    static var instance: SwiftChannelPlugin!
    init(_ channel: FlutterMethodChannel) {
        self.channel = channel
    }
    
    public static func register(with registrar: FlutterPluginRegistrar) {
        let channel = FlutterMethodChannel(name: channelName, binaryMessenger: registrar.messenger())
        let instance = SwiftChannelPlugin(channel)
        self.instance = instance
        registrar.addMethodCallDelegate(instance, channel: channel)
    }
}

extension SwiftChannelPlugin: FlutterPlugin {
    func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
        let args = call.arguments
        switch call.method {
        case "sm3EncryptText":
//            if let csString = args as? String {
//                let sm3String = GMSm3Utils.hash(with: csString)
//                result(sm3String)
//            }
            result(false)
            break
        default:
            if call.method.hasPrefix("xfVoice") {
                // IFlyManager.instance.observerMethod(method: call.method, args: call.arguments)
            }else {
                print("未找到方法名")
            }
            result(false)
            break
        }
    }
}
